package com.reider.log4AS3.dataholder
{
	import com.reider.log4AS3.core.log_internal;
	/**
	 * This class stores all basic logging information.
	 * 
	 *  @langversion ActionScript 3.0
	 * 	@playerversion Flash 9.0 
	 */
	
	public class Log
	{
		private var _time:Date
		private var _reltime:int
		private var _level:Level
		private var _loggerName:String
		private var _format:String
		private var _formattedText:String
		private var _args:Array
		private var _additionalArgs:Array
		
		/**
		 * The time when the log was fired.
		 */
		public function get time():Date
		{
			return _time
		}
		
		/**
		 * @privtae
		 */
		log_internal function set time(value:Date):void
		{
			_time = value
		}
		
		
		/**
		 * The relative time in milliseconds when the log was fired, relative to the Loggers container class.
		 */
		public function get reltime():int
		{
			return _reltime
		}
		
		/**
		 * @privtae
		 */
		log_internal function set reltime(value:int):void
		{
			_reltime = value
		}
		
		/**
		 * The level of the log.
		 */
		public function get level():Level
		{
			return _level
		}
		
		log_internal function set level(value:Level):void
		{
			_level = value
		}
		
		/**
		 * The class or the name of the logger that was specified when getting the Logger.
		 */
		
		public function get loggerName():String
		{
			return _loggerName
		}
		
		/**
		 * @privtae
		 */
		log_internal function set loggerName(value:String):void
		{
			_loggerName = value
		}
		
		
		/**
		 * The raw string added to the Logger containing the special object characters if any.
		 */
		public function get format():String
		{
			return _format
		}
		
		/**
		 * @privtae
		 */
		log_internal function set format(value:String):void
		{
			_format = value
		}
		
		/**
		 * The formatted log formatted by layouts or just with the added replacement values.
		 */
		public function get formattedText():String
		{
			return _formattedText
		}
		
		/**
		 * @privtae
		 */
		log_internal function set formattedText(value:String):void
		{
			_formattedText = value
		}
		
		/**
		 * The arguments specified when adding a log.
		 */ 
		public function get args():Array
		{
			return _args
		}
		
		/**
		 * @privtae
		 */
		log_internal function set args(value:Array):void
		{
			_args = value
		}
		
		/**
		 * The additional arguments that were not formated in the msg.
		 */
		public function get additionalArgs():Array
		{
			return _additionalArgs
		}
		
		/**
		 * @privtae
		 */
		log_internal function set additionalArgs(value:Array):void
		{
			_additionalArgs = value
		}
		
		/**
		 * @private
		 */
		public function Log()
		{	
		}
		
		/**
		 * Gives back a raw object containing all the log data.
		 * 
		 * The object will contain these properties:<br/><br/>
		 * 
		 * time, reltime, levelName, levelPriority, loggerName
		 * format, formatedText, args
		 */
		
		public function toObject():Object
		{
			var obj:Object = new Object()
			obj.time = _time
			obj.reltime = _reltime
			obj.levelName = _level.name
			obj.levelPriority = _level.priority
			obj.loggerName = _loggerName
			obj.format = _format
			obj.formattedText = _formattedText
			obj.args = _args
			
			return obj
		}
		
		/**
		 * Clones the log object.
		 * 
		 * @return The clone of the Log. 
		 */ 
		
		public function clone():Log
		{
			var log:Log = new Log()
			log.log_internal::time = _time
			log.log_internal::reltime = _reltime
			log.log_internal::level = _level
			log.log_internal::loggerName = _loggerName
			log.log_internal::format = _format
			log.log_internal::formattedText = _formattedText
			log.log_internal::args = _args
			log.log_internal::additionalArgs = _additionalArgs
			
			return log
		}

	}
}